home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Logiciels PC 7
/
logiciel pc 7.iso
/
Linux
/
KDE_1.1pr2_Rpm
/
kdesupport-1.1pre2-1rh5x.i386.rpm
/
kdesupport-1.1pre2.1rh5x.cpio.gz
/
kdesupport-1.1pre2.1rh5x.cpio
/
opt
/
kde
/
bin
/
usekde
< prev
Wrap
Text File
|
1999-01-27
|
2KB
|
94 lines
#!/bin/bash
if [ "$KDEDIR" = "" ] ; then
echo "\"usekde\" cannot run because \$KDEDIR is not set:"
echo "(Log in again, and try again)"
exit
fi
# standard RedHat/usekde default paths.
ETCPASSWD="/etc/passwd"
# default locations of sample KDE configuration files
SKELDIR="$KDEDIR/etc/skel"
# look for the default .Xclients
SAMPLE_XCLIENTS=""
# first try to use $KDE_XCLIENTS as the .Xclients
if ! [ "$KDE_XCLIENTS" = "" ] ; then
if [ -f $KDE_XCLIENTS ] ; then
SAMPLE_XCLIENTS="$KDE_XCLIENTS"
fi
fi
# if this fails, try $KDE_SKELDIR/.Xclients
if [ "$SAMPLE_XCLIENTS" = "" ] ; then
if ! [ "$KDE_SKELDIR" = "" ] ; then
if [ -f $KDE_SKELDIR/.Xclients ] ; then
SAMPLE_XCLIENTS="$KDE_SKELDIR/.Xclients"
fi
fi
fi
# if this fails, use $SKELDIR/.Xclients
if [ "$SAMPLE_XCLIENTS" = "" ] ; then
SAMPLE_XCLIENTS="$SKELDIR/.Xclients"
fi
# confirm existence of sample configuration files
if ! [ -f $SAMPLE_XCLIENTS ] ; then
echo "error: sample Xclients file $SAMPLE_XCLIENTS not found"
exit
fi
# verify username and existence of user's home directory
if [ "$1" = "" ] ; then
USERHOME=~
USERNAME=$USER
else
USERHOME=` cat $ETCPASSWD | grep -e "^$1:" | awk -F: '{print $6 }'`
if [ "$USERHOME" = "" ] ; then
echo "username $1 is invalid"
exit
fi
if ! [ -d $USERHOME ] ; then
echo "error: user $1's home directory $USERHOME does not exist"
exit
fi
USERNAME=$1
fi
# move possibly-conflicting configuration files away
XSESSION="$USERHOME/.xsession"
if [ -f $XSESSION ] ; then
XSESSION_ORIG="$XSESSION.kdesave"
echo "warning: moving existing $XSESSION to $XSESSION_ORIG"
mv -f $XSESSION $XSESSION_ORIG
fi
XINITRC="$USERHOME/.xinitrc"
if [ -f $XINITRC ] ; then
XINITRC_ORIG="$XINITRC.kdesave"
echo "warning: moving existing $XINITRC to $XINITRC_ORIG"
mv -f $XINITRC $XINITRC_ORIG
fi
XCLIENTS="$USERHOME/.Xclients"
if [ -f $XCLIENTS ] ; then
TEST_DIFF=`diff $XCLIENTS $SAMPLE_XCLIENTS`
if [ -n "$TEST_DIFF" ] ; then
XCLIENTS_ORIG="$XCLIENTS.kdesave"
echo "moving existing $XCLIENTS to $XCLIENTS_ORIG"
mv -f $XCLIENTS $XCLIENTS_ORIG
fi
fi
if ! [ -f $XCLIENTS ] ; then
echo "Installing the KDE startup script from $SAMPLE_XCLIENTS:"
cp -f $SAMPLE_XCLIENTS $XCLIENTS
chown $USERNAME. $XCLIENTS
echo "(installed as $XCLIENTS)"
fi
echo "KDE is now $USERNAME's default desktop; to change this, delete $XCLIENTS"